home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Freeware / Miro 1.0 / Miro_Installer.exe / Miro_Downloader.exe / clipboard.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2007-11-12  |  859 b   |  33 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.5)
  3.  
  4. '''clipboard.py.  Used to access the clipboard from python.'''
  5. from templatehelper import toUni
  6. from ctypes import windll, c_char_p
  7. CF_TEXT = 1
  8. OpenClipboard = windll.user32.OpenClipboard
  9. GetClipboardData = windll.user32.GetClipboardData
  10. CloseClipboard = windll.user32.CloseClipboard
  11. GlobalLock = windll.kernel32.GlobalLock
  12. GlobalUnlock = windll.kernel32.GlobalUnlock
  13.  
  14. def getText():
  15.     text = None
  16.     if OpenClipboard(None):
  17.         
  18.         try:
  19.             hClipMem = GetClipboardData(CF_TEXT)
  20.             if hClipMem:
  21.                 GlobalLock.restype = c_char_p
  22.                 text = GlobalLock(hClipMem)
  23.                 GlobalUnlock(hClipMem)
  24.         finally:
  25.             CloseClipboard()
  26.  
  27.     
  28.     if text is not None:
  29.         text = toUni(text)
  30.     
  31.     return text
  32.  
  33.